package com.ctgu.edu.service.impl;

import com.ctgu.edu.dao.ApplyMapper;
import com.ctgu.edu.dao.ResumeMapper;
import com.ctgu.edu.pojo.Account;
import com.ctgu.edu.pojo.Apply;
import com.ctgu.edu.pojo.Resume;
import com.ctgu.edu.service.AccountService;
import com.ctgu.edu.service.ApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

@Component
public class ApplyServiceImpl implements ApplyService {

    @Autowired
    @Qualifier("applyMapper")
    private ApplyMapper applyMapper;

    public void setApplyMapper(ApplyMapper applyMapper) {
        this.applyMapper = applyMapper;
    }


    public void addApply(Apply apply) {
        applyMapper.addApply(apply);
    }

    public void deleteApplyById(Integer applySeekerId,Integer applyJobId) {
        Map<String,Integer> map = new HashMap<String,Integer>();
        map.put("applySeekerId",applySeekerId);
        map.put("applyJobId",applyJobId);
        applyMapper.deleteApplyById(map);
    }

    public Account getAccountById(String accountId) {
        return null;
    }
    public void updateApply(Apply apply) {
        applyMapper.updateApply(apply);
    }

    public LinkedList<Apply> getApplyBySeekerId(Integer applySeekerId) {
        return applyMapper.getApplyBySeekerId(applySeekerId);
    }

    public LinkedList<Apply> getApplyByJobId(Integer applyJobId) {
        return applyMapper.getApplyByJobId(applyJobId);
    }

    public Apply getApplyBySeekerAndJobId(Integer applySeekerId,Integer applyJobId) {
        Map<String,Integer> map = new HashMap<String,Integer>();
        map.put("applySeekerId",applySeekerId);
        map.put("applyJobId",applyJobId);
        return applyMapper.getApplyBySeekerAndJobId(map);
    }
}
